<?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;

class User extends Model
{
    //1。关联的表
    public $table = 'user';

    //2.主键
    public $primaryKey = 'user_id';

    //3.允许批量操作的字段
    public $fillable = ['user_name','user_pass','email','phone'];

    //是否维护 create_at 和 update_at
    public $timestamps = false;

    public function role()
    {
        return $this->belongsToMany('App\Model\Role','user_role','user_id','role_id');
    }
}
